package com.whnk.model.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.whnk.common.log.annotation.Log;
import com.whnk.common.log.enums.BusinessType;
import com.whnk.common.security.annotation.PreAuthorize;
import com.whnk.model.domain.FlwTQueryLog;
import com.whnk.model.service.IFlwTQueryLogService;
import com.whnk.common.core.web.controller.BaseController;
import com.whnk.common.core.web.domain.AjaxResult;
import com.whnk.common.core.utils.poi.ExcelUtil;
import com.whnk.common.core.web.page.TableDataInfo;

/**
 * 实时查询引擎明细Controller
 * 
 * @author whnk
 * @date 2021-08-31
 */
@RestController
@RequestMapping("/log")
public class FlwTQueryLogController extends BaseController
{
    @Autowired
    private IFlwTQueryLogService flwTQueryLogService;

    /**
     * 查询实时查询引擎明细列表
     */
    @PreAuthorize(hasPermi = "model:log:list")
    @GetMapping("/list")
    public TableDataInfo list(FlwTQueryLog flwTQueryLog)
    {
        startPage();
        List<FlwTQueryLog> list = flwTQueryLogService.selectFlwTQueryLogList(flwTQueryLog);
        return getDataTable(list);
    }

    /**
     * 导出实时查询引擎明细列表
     */
    @PreAuthorize(hasPermi = "model:log:export")
    @Log(title = "实时查询引擎明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FlwTQueryLog flwTQueryLog) throws IOException
    {
        List<FlwTQueryLog> list = flwTQueryLogService.selectFlwTQueryLogList(flwTQueryLog);
        ExcelUtil<FlwTQueryLog> util = new ExcelUtil<FlwTQueryLog>(FlwTQueryLog.class);
        util.exportExcel(response, list, "实时查询引擎明细数据");
    }

    /**
     * 获取实时查询引擎明细详细信息
     */
    @PreAuthorize(hasPermi = "model:log:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(flwTQueryLogService.selectFlwTQueryLogById(id));
    }

    /**
     * 新增实时查询引擎明细
     */
    @PreAuthorize(hasPermi = "model:log:add")
    @Log(title = "实时查询引擎明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FlwTQueryLog flwTQueryLog)
    {
        return toAjax(flwTQueryLogService.insertFlwTQueryLog(flwTQueryLog));
    }

    /**
     * 修改实时查询引擎明细
     */
    @PreAuthorize(hasPermi = "model:log:edit")
    @Log(title = "实时查询引擎明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FlwTQueryLog flwTQueryLog)
    {
        return toAjax(flwTQueryLogService.updateFlwTQueryLog(flwTQueryLog));
    }

    /**
     * 删除实时查询引擎明细
     */
    @PreAuthorize(hasPermi = "model:log:remove")
    @Log(title = "实时查询引擎明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(flwTQueryLogService.deleteFlwTQueryLogByIds(ids));
    }
}
